package edu.sctu.practice.class02.hujie.online_classes_practice.imooc.Java_IO.class5to3;

import java.io.*;

/**
 * Created by hp on 2015/12/22.
 */
public class BrAndBwOrPwDemo {
    public static void main(String[] args) throws IOException {
        //对文件进行读写操作
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("F:\\桌面文件\\慕课网笔记\\文件传输基础IO流\\1.txt")));
//        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("F:\\桌面文件\\慕课网笔记\\文件传输基础IO流\\1copys.txt")));
        PrintWriter pw = new PrintWriter("F:\\桌面文件\\慕课网笔记\\文件传输基础IO流\\1copyss.txt");
//        PrintWriter pw1=new PrintWriter(outputStream,boolean autoFlush);
        String line;
        while ((line = br.readLine()) != null) {
            System.out.println(line);//一次读一行，并不能识别换行
//            bw.write(line);
//            //单独写出换行操作
//            bw.newLine();//换行操作
//            bw.flush();
            pw.println(line);
            pw.flush();//flush清空
        }
//        bw.close();
        br.close();
        pw.close();
    }
}
